package cre.sample.test.ds.order;

/**
 * Created by CreGu on 2016/5/25.
 */
public class ArrayBubble extends ArrayAbstract{

    public ArrayBubble(int size) {
        super(size);
    }

    public void bubbleSort() {
        for (int i = elements - 1; i > 0; i--) {
            for (int j = 0; j < i; j++) {
                long tmp;

                if (arr[j] > arr[j + 1]) {
                    tmp = arr[j + 1];
                    arr[j + 1] = arr[j];
                    arr[j] = tmp;
                }
            }
        }
    }
}
